
<%--
  Created by IntelliJ IDEA.
  User: 吴某
  Date: 2024/7/2
  Time: 8:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Search</title>
</head>
<style>
 body{
background-image: linear-gradient(to right, #fbc2eb, #a6c1ee);
}
 table {
     width: 80%; /* 设置表格宽度为页面宽度的80% */
     margin: auto; /* 使表格居中显示 */
     border-collapse: collapse; /* 合并边框 */
 }
 th, td {
     border: none; /* 设置单元格边框 */
     padding: 8px; /* 设置单元格内边距 */
     text-align: left; /* 设置文本左对齐 */
 }
 th {
     background-color: #f2f2f2; /* 设置表头背景颜色 */
 }
 .product-name {
     width: 60%; /* 设置商品名称列宽度为60% */
 }
 button{
     background-color: red;
 }
 #inputs{
     width: 250px;
     margin-left: 800px;
     height: 35px;
 }
#i{
    height: 35px;
}
</style>
<body>
<form action="findbooksbyuser" method="get" class="sea">
    <input type="text" name="query" placeholder="请输入关键词" id="inputs">
    <input type="submit" value="搜索" id="i">
</form>
<h1>以下是搜索到的书</h1>
<table border="1">
    <tr>
        <th>序号</th>
        <th class="product-name">商品名称</th>
        <th>作者</th>
        <th>单价</th>
        <th>库存</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${requestScope.userbook}" var="book">
        <tr>
            <td>${book.bookid}</td>
            <td >${book.title}</td>
            <td >${book.author}</td>
            <td>${book.price}</td>
            <td>${book.stock}</td>
            <td><button><a href="/addcart?BookId=${book.bookid}">加入到购物车</a></button></td>
        </tr>
    </c:forEach>
<%--<c:forEach var="product" items="${cart.products}">--%>
<%--            <tr>--%>
<%--                <td>${product.bookid}</td>--%>
<%--                <td>${product.name}</td>--%>
<%--                <td>${product.author}</td>--%>
<%--                <td>${product.price}</td>--%>
<%--                <td>${product.stock}</td>--%>
<%--            <td><button>加入购物车</button></td>--%>
<%--           </tr>--%>
<%--       </c:forEach>--%>
</table>
<a href="buyer.jsp"><h2>返回</h2></a>
</body>
</html>
